package site.taote.sboot.modules.sys.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import site.taote.sboot.modules.sys.entity.TUser;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author taote
 * @ClassName UserController
 * @Description TODO
 * @date 2018/4/15 21:06
 * @Version 1.0
 **/

@RestController
@RequestMapping("/user")
@Api(value="用户接口",tags={"用户操作接口"})
public class UserController {

    @ApiOperation(value="获取用户信息列表", notes="根据传过来的用户查询条件进行检索")
    @ApiImplicitParam(name = "user", value = "用户详细实体user", required = false, dataType = "TUser")
    @RequestMapping(value = "/users",method = RequestMethod.POST)
    @ResponseBody
    public List<TUser> users(@RequestBody(required=false)  TUser user){
        List<TUser> users = new ArrayList<>();
        for(int i=0;i<10 ;i++){
            TUser tuser = new TUser();
            tuser.setAddress("address"+i);
            tuser.setIsDeleted(false);
            tuser.setGender(1);
            tuser.setGmtCreate(new Date());
            tuser.setId((long)i+1);
            tuser.setUserName("userName"+i);
            users.add(tuser);
        }

        return users;
    }
}
